Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New telepresence replace command. #3764

Open
wants to merge 65 commits into
base: release/v2
Choose a base branch
from

Conversation

thallgren
Copy link
Member

The new telepresence replace command simplifies and clarifies container replacement.

Previously, the --replace flag within the telepresence intercept command was used to replace containers. However, this approach introduced inconsistencies and limitations:

  • Confusion: Using a flag to modify the core function of a command designed for traffic interception led to ambiguity.
  • Inaccurate Behavior: Replacement was not possible when no incoming traffic was intercepted, as the command's design focused on traffic routing.

To address these issues, the --replace flag within telepresence intercept has been deprecated. The new telepresence replace command provides a dedicated and consistent method for replacing containers, enhancing clarity and reliability.

Key differences between replace and intercept:

  1. Scope: The replace command targets and affects an entire container, impacting all its traffic, while an intercept targets specific services and/or service/container ports.
  2. Port Declarations: Remote ports specified using the --port flag are container ports.
  3. No Default Port: A replace can occur without intercepting any ports.
  4. Container State: During a replace, the original container is no longer active within the cluster.

The deprecated --replace flag still works, but is hidden from the telepresence intercept command help, and will print a deprecation warning when used.

@thallgren thallgren marked this pull request as draft January 8, 2025 11:29
@thallgren
Copy link
Member Author

Still a draft. Integration and docs are in the works.

@thallgren thallgren requested a review from P0lip January 8, 2025 11:31
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 8, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 8, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch from 1d01171 to 002afbe Compare January 8, 2025 22:50
@thallgren thallgren requested a review from njayp January 8, 2025 22:51
@thallgren thallgren force-pushed the thallgren/replace-command branch from 002afbe to b31a69e Compare January 8, 2025 22:54
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 9, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 9, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch from b31a69e to e816443 Compare January 9, 2025 18:34
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 9, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 9, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch from e816443 to 681a5a0 Compare January 9, 2025 23:39
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 9, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 9, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch from 681a5a0 to b4c333f Compare January 10, 2025 06:41
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch 4 times, most recently from 074f21b to d0d27c8 Compare January 10, 2025 08:24
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch from d0d27c8 to 215d7ff Compare January 10, 2025 10:10
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
@thallgren thallgren force-pushed the thallgren/replace-command branch from 215d7ff to 198d06a Compare January 10, 2025 10:48
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Jan 10, 2025
Introducing `telepresence replace` as an alternative to the `intercept`
resulted in a lot of documentation changes. For many (most) use-cases,
a `replace` is more natural than an `intercept` unless there's
an ability to do personal intercepts, and the OSS edition doesn't
provide that.

Signed-off-by: Thomas Hallgren <[email protected]>
@thallgren thallgren force-pushed the thallgren/replace-command branch from 1ab6cf4 to 311de3e Compare February 8, 2025 14:58
@thallgren thallgren marked this pull request as ready for review February 8, 2025 14:59
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 8, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 8, 2025
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 8, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 8, 2025
Most of the panic recovery routines were added to ensure logging the
stack-trace of the panic. Containers in pods seem to run with
`GOTRACEBACK=""` which apparently overrides the default "single"
setting. To mitigate this, the traffic-manager, traffic-agent, and
agent-init containers now use the `debug.SetTraceback("single")`

Signed-off-by: Thomas Hallgren <[email protected]>
@thallgren thallgren force-pushed the thallgren/replace-command branch from ee12df7 to 59fb3f7 Compare February 8, 2025 22:45
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 8, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 8, 2025
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 9, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 9, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how the hosted documentation URLs are built, but if they are inferred from the directory structure, we could rename the intercepts directory here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still have panic recovery in we still have serveMutatingFunc - didn't you intend to remove it in 59fb3f7#diff-e6df1931e03199997ae8c5c0ec6325293de7862dd39912c2995d2099cfa06032?

}
flags := cmd.Flags()
flags.StringVarP(&info.workloadName, "workload", "w", "",
"Name of the workload. If given, the configmap entry will be retrieved telepresence-agents configmap, mutually exclusive to --config")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Name of the workload. If given, the configmap entry will be retrieved telepresence-agents configmap, mutually exclusive to --config")
"Name of the workload. If given, the configmap entry will be retrieved from the telepresence-agents configmap, mutually exclusive to --config")

Copy link
Contributor

@P0lip P0lip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like the removal of tp agents configmap

@@ -24,6 +24,7 @@ func (s *connectedSuite) successfulIntercept(tp, wl, port string) {
2*time.Second, // polling interval
)

itest.TelepresenceOk(ctx, "loglevel", "trace")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be good to restore to the previous state

Suggested change
itest.TelepresenceOk(ctx, "loglevel", "trace")
itest.TelepresenceOk(ctx, "loglevel", "trace")
defer itest.TelepresenceOk(ctx, "loglevel", "debug")

- Remove panic recovery in mutator/service.go
- Remove extraneous loglevel setting in succesfulIntercept itest
- Remove unused `--workload` flag from some genyaml commands.

Signed-off-by: Thomas Hallgren <[email protected]>
@thallgren thallgren force-pushed the thallgren/replace-command branch from 028c18b to b1fe5a6 Compare February 10, 2025 22:55
@thallgren thallgren added the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 10, 2025
@github-actions github-actions bot removed the ok to test Applied by maintainers when a PR is ready to have tests run on it label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants